25. Solution: The Standard Library
Quiz Solution: Password Generator
To create random passwords we used import random
. The function definition was simply:
def generate_password():
return random.choice(word_list) + random.choice(word_list) + random.choice(word_list)
Alternatively, you could use the random.sample
function and .join
method for strings:
def generate_password():
return ''.join(random.sample(word_list,3))